package com.github.baichuan.web.ui.select;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 选项
 */
@Getter
public class OptionItem {
    private String label;

    private String value;

    private OptionItem(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public static OptionItem of(String label, String value){
        if(StringUtils.isBlank(label)) {
            throw new IllegalArgumentException("label is blank");
        }
        if(StringUtils.isBlank(value)) {
            throw new IllegalArgumentException("value is blank");
        }
        return new OptionItem(label, value);
    }
}
